/*
 * font.c
 *
 *  a bitmapped font for use in the system
 *
 *  copied and modified from the 4P source code, January 2000
 *  copied from the Turaco source code, December 1998 
 *
 *    YAY!  it was made for Turaco Classic, and now gets used in CL!
 *
 *  Jerry Carpenter
 *
 * $Id: font.c,v 1.6 2003/04/17 15:07:21 jerry Exp $
 */

#include "font.h"
#include <string.h>

/* first... my internal font... */
unsigned char __font_data_88[224][8] =
{
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
    { 0x3c, 0x3c, 0x38, 0x38, 0x30, 0x00, 0x30, 0x00 },
    { 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 },
    { 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00 },
    { 0x18, 0x7e, 0xc0, 0x7c, 0x06, 0xfc, 0x18, 0x00 },
    { 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00 },
    { 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00 },
    { 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
    { 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00 },
    { 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00 },
    { 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00 },
    { 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 },
    { 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 },
    { 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00 },
    { 0x7c, 0xc6, 0xce, 0xd6, 0xe6, 0xc6, 0x7c, 0x00 },
    { 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
    { 0x7c, 0xc6, 0x06, 0x7c, 0xc0, 0xc0, 0xfe, 0x00 },
    { 0xfc, 0x06, 0x06, 0x3c, 0x06, 0x06, 0xfc, 0x00 },
    { 0x0c, 0xcc, 0xcc, 0xcc, 0xfe, 0x0c, 0x0c, 0x00 },
    { 0xfe, 0xc0, 0xfc, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
    { 0x7c, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0xfe, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x00 },
    { 0x7c, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0x7c, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x7c, 0x00 },
    { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00 },
    { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30 },
    { 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00 },
    { 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00 },
    { 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00 },
    { 0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00 },
    { 0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x7e, 0x00 },
    { 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00 },
    { 0xfc, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0x00 },
    { 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00 },
    { 0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x00 },
    { 0xfe, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xfe, 0x00 },
    { 0xfe, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0x00 },
    { 0x7c, 0xc6, 0xc0, 0xc0, 0xce, 0xc6, 0x7c, 0x00 },
    { 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00 },
    { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00 },
    { 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
    { 0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xc6, 0x00 },
    { 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00 },
    { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 },
    { 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00 },
    { 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00 },
    { 0x7c, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x06 },
    { 0xfc, 0xc6, 0xc6, 0xfc, 0xd8, 0xcc, 0xc6, 0x00 },
    { 0x7c, 0xc6, 0xc0, 0x7c, 0x06, 0xc6, 0x7c, 0x00 },
    { 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
    { 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x00 },
    { 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x00 },
    { 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00 },
    { 0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x00 },
    { 0xc6, 0xc6, 0xc6, 0x7c, 0x18, 0x30, 0xe0, 0x00 },
    { 0xfe, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xfe, 0x00 },
    { 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00 },
    { 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00 },
    { 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00 },
    { 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff },
    { 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x7c, 0x06, 0x7e, 0xc6, 0x7e, 0x00 },
    { 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xfc, 0x00 },
    { 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x00 },
    { 0x06, 0x06, 0x06, 0x7e, 0xc6, 0xc6, 0x7e, 0x00 },
    { 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x00 },
    { 0x1c, 0x36, 0x30, 0x78, 0x30, 0x30, 0x30, 0x00 },
    { 0x00, 0x00, 0x7e, 0xc6, 0xc6, 0x7e, 0x06, 0xfc },
    { 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x00 },
    { 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00 },
    { 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c },
    { 0xc0, 0xc0, 0xcc, 0xd8, 0xf8, 0xcc, 0xc6, 0x00 },
    { 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
    { 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xd6, 0x00 },
    { 0x00, 0x00, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x00 },
    { 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0x00, 0x00, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0 },
    { 0x00, 0x00, 0x7e, 0xc6, 0xc6, 0x7e, 0x06, 0x06 },
    { 0x00, 0x00, 0xfc, 0xc6, 0xc0, 0xc0, 0xc0, 0x00 },
    { 0x00, 0x00, 0x7e, 0xc0, 0x7c, 0x06, 0xfc, 0x00 },
    { 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x0e, 0x00 },
    { 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x00 },
    { 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x00 },
    { 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00 },
    { 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00 },
    { 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0xfc },
    { 0x00, 0x00, 0xfe, 0x0c, 0x38, 0x60, 0xfe, 0x00 },
    { 0x0e, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0e, 0x00 },
    { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 },
    { 0x70, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x70, 0x00 },
    { 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
    { 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00 },
    { 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xd6, 0x7c, 0x30 },
    { 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x00 },
    { 0x0e, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x00 },
    { 0x7e, 0x81, 0x3c, 0x06, 0x7e, 0xc6, 0x7e, 0x00 },
    { 0x66, 0x00, 0x7c, 0x06, 0x7e, 0xc6, 0x7e, 0x00 },
    { 0xe0, 0x00, 0x7c, 0x06, 0x7e, 0xc6, 0x7e, 0x00 },
    { 0x18, 0x18, 0x7c, 0x06, 0x7e, 0xc6, 0x7e, 0x00 },
    { 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xd6, 0x7c, 0x30 },
    { 0x7e, 0x81, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x00 },
    { 0x66, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x00 },
    { 0xe0, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x00 },
    { 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00 },
    { 0x7c, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00 },
    { 0x70, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00 },
    { 0xc6, 0x10, 0x7c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00 },
    { 0x38, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc6, 0x00 },
    { 0x0e, 0x00, 0xfe, 0xc0, 0xf8, 0xc0, 0xfe, 0x00 },
    { 0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00 },
    { 0x3f, 0x6c, 0xcc, 0xff, 0xcc, 0xcc, 0xcf, 0x00 },
    { 0x7c, 0x82, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0x66, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0xe0, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0x7c, 0x82, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x00 },
    { 0xe0, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x00 },
    { 0x66, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x7c },
    { 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x00 },
    { 0x18, 0x18, 0x7e, 0xd8, 0xd8, 0xd8, 0x7e, 0x18 },
    { 0x38, 0x6c, 0x60, 0xf0, 0x60, 0x66, 0xfc, 0x00 },
    { 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18 },
    { 0xf8, 0xcc, 0xcc, 0xfa, 0xc6, 0xcf, 0xc6, 0xc3 },
    { 0x0e, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0xd8, 0x70 },
    { 0x0e, 0x00, 0x7c, 0x06, 0x7e, 0xc6, 0x7e, 0x00 },
    { 0x1c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00 },
    { 0x0e, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0x0e, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x00 },
    { 0x00, 0xfe, 0x00, 0xfc, 0xc6, 0xc6, 0xc6, 0x00 },
    { 0xfe, 0x00, 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0x00 },
    { 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00 },
    { 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x7e, 0x00, 0x00 },
    { 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3c, 0x00 },
    { 0x00, 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00 },
    { 0xc6, 0xcc, 0xd8, 0x3f, 0x63, 0xcf, 0x8c, 0x0f },
    { 0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6d, 0xcf, 0x03 },
    { 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
    { 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00 },
    { 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00 },
    { 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88 },
    { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa },
    { 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77 },
    { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18 },
    { 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36 },
    { 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36 },
    { 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18 },
    { 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
    { 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00 },
    { 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00 },
    { 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00 },
    { 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18 },
    { 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00 },
    { 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18 },
    { 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36 },
    { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00 },
    { 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36 },
    { 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00 },
    { 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18 },
    { 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00 },
    { 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18 },
    { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36 },
    { 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36 },
    { 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18 },
    { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
    { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
    { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 },
    { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f },
    { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x76, 0xdc, 0xc8, 0xdc, 0x76, 0x00 },
    { 0x38, 0x6c, 0x6c, 0x78, 0x6c, 0x66, 0x6c, 0x60 },
    { 0x00, 0xfe, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0x00 },
    { 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x00 },
    { 0xfe, 0x60, 0x30, 0x18, 0x30, 0x60, 0xfe, 0x00 },
    { 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0x70, 0x00 },
    { 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0 },
    { 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x00 },
    { 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x7e },
    { 0x3c, 0x66, 0xc3, 0xff, 0xc3, 0x66, 0x3c, 0x00 },
    { 0x3c, 0x66, 0xc3, 0xc3, 0x66, 0x66, 0xe7, 0x00 },
    { 0x0e, 0x18, 0x0c, 0x7e, 0xc6, 0xc6, 0x7c, 0x00 },
    { 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00 },
    { 0x06, 0x0c, 0x7e, 0xdb, 0xdb, 0x7e, 0x60, 0xc0 },
    { 0x38, 0x60, 0xc0, 0xf8, 0xc0, 0x60, 0x38, 0x00 },
    { 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00 },
    { 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00 },
    { 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00 },
    { 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xfc, 0x00 },
    { 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xfc, 0x00 },
    { 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18 },
    { 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70 },
    { 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00 },
    { 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00 },
    { 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 },
    { 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c },
    { 0x78, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00 },
    { 0x7c, 0x0c, 0x7c, 0x60, 0x7c, 0x00, 0x00, 0x00 },
    { 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00 },
    { 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
};

/* for the intnernal font (Zarnox) */
FONT_DEFINITION __font_Internal_88 = 
{
    8, 8, 
    ' ', ' '+224, 
    (unsigned char *) __font_data_88
};

FONT_DEFINITION * font_Internal_88 = &__font_Internal_88;


/* next... a tiny 6x3 font... */
unsigned char __font_data_36[22][8] =
{
    { 0x40, 0xA0, 0xA0, 0xA0, 0x40, 0x00, 0x00, 0x00 },  /* "0" */
    { 0x40, 0xC0, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00 },  /* "1" */
    { 0xE0, 0x20, 0xE0, 0x80, 0xE0, 0x00, 0x00, 0x00 },  /* "2" */
    { 0xE0, 0x20, 0x60, 0x20, 0xE0, 0x00, 0x00, 0x00 },  /* "3" */
    { 0x20, 0xA0, 0xE0, 0x20, 0x20, 0x00, 0x00, 0x00 },  /* "4" */
    { 0xE0, 0x80, 0xC0, 0x20, 0xC0, 0x00, 0x00, 0x00 },  /* "5" */
    { 0xE0, 0x80, 0xE0, 0xA0, 0xE0, 0x00, 0x00, 0x00 },  /* "6" */
    { 0xE0, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00 },  /* "7" */
    { 0xE0, 0xA0, 0xE0, 0xA0, 0xE0, 0x00, 0x00, 0x00 },  /* "8" */
    { 0xE0, 0xA0, 0xE0, 0x20, 0x20, 0x00, 0x00, 0x00 },  /* "9" */

    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },  /* ":" */  /* " " */
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },  /* ";" */  /* " " */

    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00 },  /* "<" */  /* 1s */
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00 },  /* "=" */  /* 2s */
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00 },  /* ">" */  /* 3s */

    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },  /* "?" */  /* " " */

    { 0x40, 0xA0, 0xE0, 0xA0, 0xA0, 0x00, 0x00, 0x00 },  /* "A" */
    { 0xC0, 0xA0, 0xC0, 0xA0, 0xC0, 0x00, 0x00, 0x00 },  /* "B" */
    { 0xE0, 0xA0, 0x80, 0xA0, 0xE0, 0x00, 0x00, 0x00 },  /* "C" */
    { 0xC0, 0xA0, 0xA0, 0xA0, 0xC0, 0x00, 0x00, 0x00 },  /* "D" */
    { 0xE0, 0x80, 0xC0, 0x80, 0xE0, 0x00, 0x00, 0x00 },  /* "E" */
    { 0xE0, 0x80, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00 }   /* "F" */
};

/* for the intnernal small font  */
FONT_DEFINITION __font_Internal_36 = 
{
    3, 8, 
    48, 70, 
    (unsigned char *) __font_data_36
};

FONT_DEFINITION * font_Internal_36 = &__font_Internal_36;


/* how about some colors... */
PIXEL font_White  = { 0xff, 0xff, 0xff, 0x02 };
PIXEL font_Gray50 = { 0x7f, 0x7f, 0x7f, 0x02 };
PIXEL font_Red    = { 0xff, 0x22, 0x22, 0x01 };
PIXEL font_Red2   = { 0xff, 0x22, 0x22, 0x02 };

/* for our rendering routine, we'll need this... */
unsigned char __fontbits[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};


/*
 * font_RenderChar
 *
 *  draw out a character
 */
void
font_RenderChar(
	IMAGE * dest,
	PIXEL * color,
	FONT_DEFINITION * font,
	int x,
	int y,
	int c
)
{
    int row, pix;
    int offset, foffset;

    row = 0;
    offset = (dest->width * y) + x;

    /* make sure we've got what we need... */
    if( !dest || !color || !font ) return;

    /* some range checks */
    if( x < 0 || x+font->width > dest->width ) return;
    if( y < 0 || y+font->height > dest->height ) return;
    if( c < font->min_ascii || c > font->max_ascii ) return;

    /* adjust the character */
    c -= font->min_ascii;

    /* draw the character */
    for (row = 0 ; row < font->height ; row ++)
    {
	/*foffset = (c * font->width) + row; */
	foffset = (c * 8) + row;
	for (pix = 0 ; pix < font->width && pix < 8 ; pix++) 
	{
	    if (font->data[foffset] & __fontbits[pix])
	    {
		dest->data[offset+pix].r = color->r;
		dest->data[offset+pix].g = color->g;
		dest->data[offset+pix].b = color->b;
		dest->data[offset+pix].a = color->a;
	    }
	}
	offset += dest->width;
    }
}



/* font_RenderText
 *
 *  draw out some left-justified text
 */
void 
font_RenderText(
	IMAGE * dest, 
	PIXEL * color, 
	FONT_DEFINITION * font,
	int x, 
	int y, 
	char * text
)
{
    int c;
    int maxchar = 0;
    if (!dest || !color || !font || !text)  return;
    if (!font->data) return;

    maxchar = ((dest->width - x -1) / font->width);   /* for simple clipping */

    for (c=0 ; text[c] != '\0' && c < maxchar; c++)
    {
	font_RenderChar(dest, color, font, x+(c*font->width), y, text[c]);
    }
}


/* font_RenderTextCentered
 *
 *   draw out some center-justified text, centered at x,y
 */
void
font_RenderTextCentered(
	IMAGE * dest, 
	PIXEL * color, 
	FONT_DEFINITION * font,
	int x, 
	int y, 
	char * text
)
{
    if (!font || !text) return;

    font_RenderText(dest, color, font, 
		x - (font->width * strlen(text))/2,
		y,
		text);
}


/* font_RenderTextRight
 *
 *  draw out some right-justified text
 */
void
font_RenderTextRight(
	IMAGE * dest, 
	PIXEL * color, 
	FONT_DEFINITION * font,
	int x, 
	int y, 
	char * text
)
{
    if (!font || !text) return;

    font_RenderText(dest, color, font, 
		x - (font->width * strlen(text)),
		y,
		text);
}
